<?php
/**
 * Created by PhpStorm.
 * User: a
 * Date: 2016/6/7
 * Time: 17:32
 */
namespace Admin\Model;
use Think\Model;

class InvestProfitModel extends Model 
{
    protected $trueTableName = 'bypal_invest_profit';


    /**
	 * 投资管理详情页数据
	 */
	public function get_invest_detail($invest_id,$customer_id) 
	{
		$select_sql = "select t1.period_number,t1.invest_detail_id,t3.cust_name,t1.start_time,t1.end_time,t2.invest_rate,t1.period_money_count,t1.recovery_money,t1.invest_interest,t1.profit_count,DATE_FORMAT(t1.profit_time,'%Y-%m-%d') profit_time,t1.invest_income_id 
				from bypal_invest_profit t1 
				left join bypal_invest_project t2 on t1.invest_detail_id = t2.invest_id 
				left join bypal_cust_info t3 on t1.customer_id = t3.cust_id 
				where t1.invest_detail_id=".$invest_id." and t1.customer_id=".$customer_id."
				order by t1.period_number";
		$Model = new \Think\Model();
		$values = $Model->query($select_sql);

		return $values;
	}
}